<template>
    <div>
        <h1>新增用户</h1>
        <table>
            <tbody>
                <tr>
                    <td>会员名称</td>
                    <td>
                        <input type="text" v-model="data.name">
                    </td>
                </tr>
                <tr>
                    <td>手机号</td>
                    <td>
                        <input type="text" v-model="data.phone">
                    </td>
                </tr>
                <tr>
                    <td>创建时间</td>
                    <td>
                        <input type="date" v-model="data.ctime">
                    </td>
                </tr>
                <tr>
                    <td>状态</td>
                    <td>
                        <input type="radio" v-model="data.stata" :value="true" >激活
                        <input type="radio" v-model="data.stata" :value="false" >未激活
                    </td>
                </tr>
                <tr>
                   
                    <td colspan="2">
                        <input type="button" value="添加" @click="funadd">
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</template>
<script setup lang="ts">
import {ref} from 'vue'
import axios from 'axios';
import { useRoute} from 'vue-router';
const data=ref ({
    "id": 0,
  "name": "",
  "phone": "",
  "ctime": "2025-03-23T13:05:21.141Z",
  "stata": true
})
  const funadd=()=>{
  
    axios.post("https://localhost:7176/api/User/AddAsync",data.value).then(res=>{
        if(res.data>0){
            alert('添加成功');
        }
        else{
            alert('添加失败');
        }
    })
  }
</script>